#include<iostream>
using namespace std;
typedef long long ll;
const  int mod = 998242353;
const int N = 1000000;
int prime[N]; int cnt;
bool num[N];
ll ans;
ll a, b;
void get_prime() {
	for (ll i = 2; i < N; i++) {
		if (!num[i]) {
			prime[cnt++] = i;
		}
		for (ll j = i * i; j < N; j = j + i) {
			num[j] = 1;
		}
	}
}
int Euler(ll n) {
	ll result = n % mod;
	for (ll i = 0; i < cnt;i++) {
		if (n % prime[i] == 0) {
			while (n % prime[i] == 0) {
				n /= prime[i];
			}
			result = (result - result / prime[i]) % mod;
		}
	}
	if (n > 1) {
		result = (result - result / n) % mod;
	}
	return result;
}
int qmi(ll p, ll q) {
	int m = p % mod;
	int result = 1;
	while (q > 0) {
		if (q % 2 == 1) {
			result = (result * p) % mod;
		}
		p = (p * p) % mod;
		q /= 2;
	}
	return result;
}
int main()
{
	cin >> a >> b;
	get_prime();
	int t = Euler(a);
	ans = qmi(a, b - 1) * t % mod;
	cout << ans;
}
